package com.dstation.domain;

import com.dstation.utils.Constants;
import org.springframework.stereotype.Component;

import java.sql.Timestamp;


public class CommonMessage {

    private long messageId;

    private String messageType;

    private String linkURL;

    private Timestamp createDate;




    public long getMessageId() {
        return messageId;
    }

    public void setMessageId(long messageId) {
        this.messageId = messageId;
    }

    public String getMessageType() {
        return messageType;
    }

    public void setMessageType(String messageType) {
        this.messageType = messageType;
    }

    public String getLinkURL() {
        return linkURL;
    }

    public void setLinkURL(String linkURL) {
        this.linkURL = linkURL;
    }

    public Timestamp getCreateDate() {
        return createDate;
    }

    public void setCreateDate(Timestamp createDate) {
        this.createDate = createDate;
    }


    //对评论消息适配
    public CommonMessage(VideoCommentInfo videoCommentInfo){

        setMessageType(Constants.MESSAGE_COMMENT);

        setLinkURL(Constants.MESSAGE_COMMENT_URL+"videoId="+videoCommentInfo.getVideoId()+"&isFree=1");



        setMessageId(videoCommentInfo.getVideoCommentId());
        setCreateDate(videoCommentInfo.getCreateDate());
    }
    //对视频消息适配
    public CommonMessage(VideoInfo videoInfo){

        setMessageType(Constants.MESSAGE_COMMENT);


        setLinkURL(Constants.MESSAGE_VIDEO_URL+"videoId="+videoInfo.getVideoId()+"&isFree=1");

        setMessageId(videoInfo.getVideoId());
        setCreateDate(videoInfo.getCreateDate());
    }

    //对动态消息适配
    public CommonMessage(DynamicInfo data){

        setMessageType(Constants.MESSAGE_DYNAMIC);


        setLinkURL(Constants.MESSAGE_DYNAMIC_URL+"dynamicId="+data.getDynamicId());

        setMessageId(data.getDynamicId());
        setCreateDate(data.getCreateDate());
    }
    //对点赞消息适配
    public CommonMessage(VideoLikedInfo data){

        setMessageType(Constants.MESSAGE_LIKED);


        setLinkURL(Constants.MESSAGE_LIKED_URL+"videoId="+data.getVideoId()+"&isFree=1");

        setMessageId(data.getVideoLikedId());
        setCreateDate(data.getCreateDate());
    }
    //对投币消息适配
    public CommonMessage(CoinOperatedInfo data){

        setMessageType(Constants.MESSAGE_COIN);


        setLinkURL(Constants.MESSAGE_COIN_URL+"videoId="+data.getVideoId()+"&isFree=1");

        setMessageId(data.getCoinOperatedId());
        setCreateDate(data.getCreateDate());
    }
    //对订单充值消息适配
    public CommonMessage(OrderInfo data){

        setMessageType(Constants.MESSAGE_RECHARGE);


        setLinkURL(Constants.MESSAGE_RECHARGE_URL+"orderId="+data.getOrderId());

        setMessageId(data.getOrderId());
        setCreateDate(data.getCreateDate());
    }
}
